#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	int a[10000], n,count=0;
	cin >> n;
	if (n >= 1 && n <= 100)
	{
		a[0] = n;
		for (int i = 1; i < 100000; i++)
		{
			if (n == 1)
				break;
			if (n % 2 != 0)
			{
				n = 3 * n + 1;
				a[i] = n;
			}
			else if (n % 2 == 0)
			{
				n = n / 2;
				a[i] = n;
			}
			count++;
		}
		for (int i = count; i >= 0; i--)
			cout << a[i] << " ";
	}
    return 0;
}